#
# @lc app=leetcode.cn id=263 lang=python3
#
# [263] 丑数
#

# @lc code=start
class Solution:
    def isUgly(self, n: int) -> bool:
        def divide_clear(a, b):
            if not a:
                return a
            if b==1:
                return a
            while not a%b:
                a //= b
            return a
        n = divide_clear(n, 2)
        n = divide_clear(n, 3)
        n = divide_clear(n, 5)
        return n==1
# @lc code=end

if __name__=='__main__':
    solution = Solution()
    n=0
    print(solution.isUgly(n))